﻿<%@ Page Title="Mesas" Language="C#" MasterPageFile="~/Site.Master" CodeBehind="Default.aspx.cs" Inherits="Kakaroto.Administracao.Mesa.Default" %>
<%@ Register TagPrefix="FriendlyUrls" Namespace="Microsoft.AspNet.FriendlyUrls" %>
<asp:Content runat="server" ContentPlaceHolderID="MainContent">
    <h2>Mesas</h2>
    <p>
        <asp:HyperLink runat="server" NavigateUrl="Insert" Text="Create new" />
    </p>
    <div>
        <asp:ListView id="ListView1" runat="server"
            DataKeyNames="Id" 
			ItemType="Kakaroto.Models.Mesa"
            SelectMethod="GetData">
            <EmptyDataTemplate>
                Não existem mesas cadastradas
            </EmptyDataTemplate>
            <LayoutTemplate>
                <table class="table">
                    <thead>
                        <tr>
                            <th>
								<asp:LinkButton Text="Id" CommandName="Sort" CommandArgument="Id" runat="Server" />
							</th>
                            <th>
								<asp:LinkButton Text="Cadeiras" CommandName="Sort" CommandArgument="Cadeiras" runat="Server" />
							</th>
                            <th>
								<asp:LinkButton Text="Reservada" CommandName="Sort" CommandArgument="Reserva" runat="Server" />
							</th>
                            <th>
								<asp:LinkButton Text="Cliente" CommandName="Sort" CommandArgument="Cliente" runat="Server" />
							</th>
                            <th>
								<asp:LinkButton Text="Horário" CommandName="Sort" CommandArgument="Hora" runat="Server" />
							</th>
                            
                            
                            <th>&nbsp;</th>
                        </tr>
                    </thead>
                    <tbody>
                        <tr runat="server" id="itemPlaceholder" />
                    </tbody>
                </table>
				<asp:DataPager PageSize="5"  runat="server">
					<Fields>
                        <asp:NextPreviousPagerField ShowLastPageButton="False" ShowNextPageButton="False" ButtonType="Button" ButtonCssClass="btn" />
                        <asp:NumericPagerField ButtonType="Button"  NumericButtonCssClass="btn" CurrentPageLabelCssClass="btn disabled" NextPreviousButtonCssClass="btn" />
                        <asp:NextPreviousPagerField ShowFirstPageButton="False" ShowPreviousPageButton="False" ButtonType="Button" ButtonCssClass="btn" />
                    </Fields>
				</asp:DataPager>
            </LayoutTemplate>
            <ItemTemplate>
                <tr>
							<td>
								<asp:DynamicControl runat="server" DataField="Id" ID="Id" Mode="ReadOnly" />
							</td>
							<td>
								<asp:DynamicControl runat="server" DataField="Cadeiras" ID="Cadeiras" Mode="ReadOnly" />
							</td>
							<td>
								<asp:DynamicControl runat="server" DataField="Reserva" ID="Reserva" Mode="ReadOnly" />
							</td>
					<td>
								<asp:DynamicControl runat="server" DataField="Cliente" ID="Cliente" Mode="ReadOnly" />
							</td>		
                    <td>
								<asp:DynamicControl runat="server" DataField="Hora" ID="Hora" Mode="ReadOnly" />
							</td>
							
                    <td>
					    <asp:HyperLink runat="server" NavigateUrl='<%# FriendlyUrl.Href("~/Administracao/Mesa/Details", Item.Id) %>' Text="Detalhes" /> | 
					    <asp:HyperLink runat="server" NavigateUrl='<%# FriendlyUrl.Href("~/Administracao/Mesa/Edit", Item.Id) %>' Text="Reservar" /> | 
                        <asp:HyperLink runat="server" NavigateUrl='<%# FriendlyUrl.Href("~/Administracao/Mesa/Delete", Item.Id) %>' Text="Excluir Mesa" />| 
                        <asp:HyperLink runat="server" NavigateUrl='<%# FriendlyUrl.Href("~/Administracao/Mesa/Clear", Item.Id, Item.Reserva) %>' Text="Excluir Reserva" />
                    </td>
                </tr>
            </ItemTemplate>
        </asp:ListView>
    </div>
</asp:Content>

